//
// Created by ds on 24-6-28.
//

#ifndef CARLASIMULATION_H
#define CARLASIMULATION_H

#include "SumoEntity.h"
#include <carla/client/Client.h>
#include "Entity.h"

using namespace carla;

class CarlaSimulation {
    std::string host;
    int port;
    double stepLength;
    client::Client client;
    client::World world;
    traffic_manager::TrafficManager trafficManager;
    SharedPtr<client::BlueprintLibrary> blueprint_library;

public:
    explicit CarlaSimulation(const CarlaArguments& carlaArguments);

    explicit CarlaSimulation(const std::string &host = "localhost", int port = 2000, double step_length = 0.01,
                             int trafficManagerPort = 8000);

    explicit CarlaSimulation(std::string map = "Town10HD", const std::string &host = "localhost", int port = 2000,
                             double step_length = 0.01, int trafficManagerPort = 8000);

    ~CarlaSimulation();

    client::Client getClient() const;

    client::World getWorld() const;

    traffic_manager::TrafficManager getTrafficManager() const;

    SharedPtr<client::BlueprintLibrary> getBlueprintLibrary() const;

    client::World loadWorld(std::string map);

    void setSynchronousMode(bool synchronous);

    SharedPtr<client::Actor> spawnActor(const client::ActorBlueprint &blueprint, const geom::Transform &transform);
};


#endif //CARLASIMULATION_H
